<include file="/public/header" />
<!-- // 默认操作按钮 -->
<div class="layui-card-header layadmin-card-header-auto ">
    <div class="layui-form">
        <div class="layui-form-item">

            <div class="layui-inline">
                <!-- // 打开添加页面 -->
                <button data-area="762px,95%" class="layui-btn icon-btn" lay-open=""
                    data-title="{:__('添加')}{:__('订单商品')}" data-url="{:url('/system/putorder/goods_add')}?id={:input('id')}" callback="add"
                    lay-event="add">
                    <i class="layui-icon layui-icon-add-1"></i>{:__('订单商品')}
                </button>
                <div class="layui-divider layui-divider-vertical"></div>
            </div>
        </div>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<script type="text/html" id="editforms">
    <div class="layui-fluid layui-bg-white" >
        <form class="layui-form layui-form-fixed" lay-filter="editforms">
        <input type="text" name="id" hidden="">
        <div class="layui-form-item">
            <label class="layui-form-label">{:__('订单号')}</label>
            <div class="layui-input-block">
                <input name="id" value="" disabled  type="text" class="layui-input"  lay-verify="required" />
            </div>
        </div> 
        <div class="layui-form-item">
            <label class="layui-form-label">{:__('更改后数量')}</label>
            <div class="layui-input-block">
                <input name="number" value="" placeholder="{:__('请输入更改后数量')}" type="text" class="layui-input"  lay-verify="required" />
            </div>
        </div>
        <div class="layui-footer layui-form-item layui-center "  >
            <button class="layui-btn layui-btn-primary" type="button" sa-event="closePageDialog" >{:__('取消')}</button>
            <button class="layui-btn" lay-edit="{:url('/system/putorder/goods_edit')}" lay-filter="submitPage" lay-submit>{:__('提交')}</button>
        </div>              
        </form>
    </div>
    </script>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <a class="layui-table-text" data-title="{:__('更改数量')}" data-url="#editforms" lay-event="edit">{:__('更改数量')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" data-url="{:url('/system/putorder/goodsdel')}?id={{d.id}}" lay-event="del">{:__('删除')}</a>
</script>

<include file="/public/footer" />
<script>
    layui.use(['admin', 'table', 'form'], function () {
        var admin = layui.admin;
        var table = layui.table;
        var form = layui.form;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url('/system/putorder/goods')}",
            where: {
                id:"{:input('id')}"
            }
            , page: true
            , limit: 18
            , cols: [[
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                { field: 'title', align: 'left', title: '{:__("产品名称")}' },
                { field: 'codes', align: 'left', title: '{:__("编码")}' },
                { field: 'spec', align: 'left', title: '{:__("规格")}' },
                { field: 'number', align: 'left', title: '{:__("下单数量")}' },
                { field: 'remark', align: 'left', title: '{:__("备注")}' },
                {
                    field: 'images', align: 'center', width: 100, templet: function (d) {
                        return d.images[0] ? '<div><img src="' + d.images[0] + '" width="50" height="50" lay-image-hover="" ></div>' : '<div></div>';
                    }, title: '图片'
                },
                { field: 'price', align: 'left', title: '{:__("价格")}' },
                { align: 'center', toolbar: '#tableBar', width: 160, title: '{:__("操作")}' },
            ]],
        })
    })
</script>